Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

104
Views
Cómo agregar [event.target.name] en el selector de matriz - aplicación next.js

Tengo dos controladores onChange en mi próxima aplicación, y me gustaría dividir estos dos controladores onChange en uno. El problema es que realmente no sé cómo hacer la sintaxis correcta en el selector de matriz

 // Working solution with two handlers const ticketPriceInreaseHandler = ( e: { target: HTMLInputElement }, index: number, index2: number ) => { const items = action.ticketsOnWave; items[index].wave[index2].price = e.target.value; setAction({ ...action, ticketsOnWave: [...items], }); }; const ticketPiecesInreaseHandler = ( e: { target: HTMLInputElement }, index: number, index2: number ) => { const items = action.ticketsOnWave; items[index].wave[index2].pieces = e.target.value; setAction({ ...action, ticketsOnWave: [...items], }); };

Intento hacer que un solo controlador como en el ejemplo, pero siempre obtengo errores ...

 const oneHandler = ( e: { target: HTMLInputElement }, index: number, index2: number ) => { const items = action.ticketsOnWave; items[index].wave[index2].event.taget.name = e.target.value; // Here is problem setAction({ ...action, ticketsOnWave: [...items], }); };

o lo pruebo

 const nameOfField = e.target.name items[index].wave[index2].nameOfField = e.target.value; // here i getting new in object field instead of field name from const nameOfField

¿Cuál es una sintaxis correcta para esto? Gracias

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!